define([], function() {
    var tpl = {};

    tpl.medicineBigClass = function() {
        return medicineBigClass();
    }
    tpl.medicineSmallClass = function() {
        return medicineSmallClass();
    }
    tpl.addSmallClass = function() {
        return addSmallClass();
    }
    tpl.add = function() {
        return add();
    }
    tpl.smallClass = function() {
        return smallClass();
    }
    tpl.selectCallBack = function() {
        return selectCallBack();
    }
    
    var medicineBigClass = function() {
        return  '<script id="tpl_drugList_medicineBigClass" type="text/html">' +
                '   <div class="btn-group" role="group" aria-label="...">' +
                '       {{each list as value i}}' +
                '           <button type="button" class="btn btn-default" id="{{value.id}}">{{value.className}}</button>' +
                '       {{/each}}' +
                '   </div>' +
                '</script>';
    }
    var medicineSmallClass = function() {
        return  '<script id="tpl_drugList_medicineSmallClass" type="text/html">' +
                '   <div>' +
                '       <button type="button" class="btn btn-default">全部</button>' +
                '       {{each list as value i}}' +
                '           <button type="button" class="btn btn-default smallClass" id="{{value.id}}">{{value.catalog_name}}</button>' +
                '       {{/each}}' +
                '       <button id="addSmallClass" type="button" class="btn btn-default"><i class="fa fa-plus" aria-hidden="true"></i></button>' +
                '       <button id="modifySmallClass" type="button" class="btn btn-default"><i class="fa fa-cog" aria-hidden="true"></i></button>' +
                '   </div>' +
                '</script>';
    }
    var addSmallClass = function() {
        return  '<script id="drugList_addSmallClass" type="text/html">' +
                '   <div class="druglist-modal">' +
                '       <div class="form-group">' +
                '           <input id="catalogName" type="text" class="form-control" placeholder="请输入药品小类名称"></input>' +
                '       </div>' +
                '       <div class="addSmallClass" id="add">添加</div>' +
                '   </div>' +
                '</script>';
    }
    var add = function() {
        return  '<script id="drugList_add" type="text/html">' +
                '   <div class="druglist-modal">'+
                '       <div class="form-horizontal clearfix">'+
                '          <div class="form-group col-sm-12 col-md-12">'+
                '              <label class="control-label"><i class="no-null">*</i>药品名称</label>'+
                '              <div class="control-input position-relative">'+
                '                  <input type="text" class="form-control" id="medicineName" placeholder="请输入药品名称" value="{{medicine_name}}" {{if status=="readonly" || (status=="update" && isApplyInCourse) }}readonly{{/if}}>'+
                '                  <div id="inputQuery" class="medicine-list"></div>' +
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-6 col-md-6">'+
                '              <label class="control-label"><i class="no-null">*</i>药品大类</label>'+
                '              <div class="control-input">'+
                '                  <select class="form-control" id="classId" {{if status=="readonly" || status=="update" && isApplyInCourse}}disabled{{/if}}>' +
                '                      {{each bigClass as value i}}' +
                '                          <option value="{{value.id}}" {{if value.id==class_id}}selected{{/if}}>{{value.className}}</option>' +
                '                      {{/each}}' +
                '                  </select>' +
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-6 col-md-6 grid-label-7">'+
                '              <label class="control-label"><i class="no-null">*</i>药品小类</label>'+
                '              <div class="control-input">'+
                '                  <select class="form-control" id="catalogId" {{if status=="readonly" || (status=="update" && isApplyInCourse) }}disabled{{/if}}>' +
                '                      {{each smallClass as value i}}' +
                '                          <option value="{{value.id}}" {{if value.id==parentId}}selected{{/if}}>{{value.catalog_name}}</option>' +
                '                      {{/each}}' +
                '                  </select>' +
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-6 col-md-6">'+
                '              <label class="control-label"><i class="no-null">*</i>服用周期</label>'+
                '              <div class="control-input frequency clearfix">'+
                '                  <input id="frequencyDay" type="number" min="0" value="{{frequency_day}}" placeholder="天"  class="form-control" {{if status=="readonly"}}readonly{{/if}}><span>天</span>' +
                '                  <input id="frequencyTime" type="number" min="0" value="{{frequency_time}}" placeholder="次"  class="form-control" {{if status=="readonly"}}readonly{{/if}}><span>次</span>' +
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-6 col-md-6 grid-label-7">'+
                '              <label class="control-label"><i class="no-null">*</i>计算方式</label>'+
                '              <div class="control-input">'+
                '                  <select class="form-control" id="calcuMethod" {{if status=="readonly" || (status=="update" && isApplyInCourse)}}disabled{{/if}}>' +
                '                      <option value="01" {{if calcu_method=="01"}}selected{{/if}}>体表面积</option>' +
                '                      <option value="02" {{if calcu_method=="02"}}selected{{/if}}>体重</option>' +
                '                  </select>' +
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-6 col-md-6">'+
                '              <label class="control-label"><i class="no-null">*</i>药品剂量</label>'+
                '              <div class="control-input">'+
                '                  <input type="text" class="form-control" id="medicineDose" placeholder="请输入药品总剂量" value="{{medicine_dose}}" {{if status=="readonly"}}readonly{{/if}}>'+
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-6 col-md-6 grid-label-7">'+
                '              <label class="control-label"><i class="no-null">*</i>药品剂量单位</label>'+
                '              <div class="control-input">'+
                '                  <select class="form-control" id="medUnitId" {{if status=="readonly" || (status=="update" && isApplyInCourse) }}disabled{{/if}}>' +
                '                      {{each units as value i}}' +
                '                          <option value="{{value.id}}" {{if med_unit_id==value.id}}selected{{/if}}>{{value.unit_name}}</option>' +
                '                      {{/each}}' +
                '                  </select>' +
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-6 col-md-6">'+
                '              <label class="control-label"><i class="no-null">*</i>药品类型</label>'+
                '              <div class="control-input">'+
                '                  <select class="form-control" id="medicineType" {{if status=="readonly" || (status=="update" && isApplyInCourse) }}disabled{{/if}}>' +
                '                      <option value="1" {{if medicine_type=="1"}}selected{{/if}}>正常用药</option>' +
                '                      <option value="2" {{if medicine_type=="2"}}selected{{/if}}>补充用药</option>' +
                '                  </select>' +
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-6 col-md-6 grid-label-7">'+
                '              <label class="control-label">药品性状</label>'+
                '              <div class="control-input">'+
                '                  <input type="text" class="form-control" id="character" value="{{character}}" {{if status=="readonly" || (status=="update" && isApplyInCourse)}}readonly{{/if}}>'+
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-12 col-md-12">'+
                '              <label class="control-label">适用症</label>'+
                '              <div class="control-input">'+
                '                  <input type="text" class="form-control" id="indication" value="{{indication}}" {{if status=="readonly" || (status=="update" && isApplyInCourse)}}readonly{{/if}}>'+
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-12 col-md-12">'+
                '              <label class="control-label">不良反应</label>'+
                '              <div class="control-input">'+
                '                  <textarea id="adverseReaction" class="form-control" {{if status=="readonly" || (status=="update" && isApplyInCourse)}}readonly{{/if}}>{{adverse_reaction}}</textarea>' +
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-12 col-md-12">'+
                '              <label class="control-label">禁忌</label>'+
                '              <div class="control-input">'+
                '                  <textarea id="taboo" class="form-control" {{if status=="readonly" || (status=="update" && isApplyInCourse)}}readonly{{/if}}>{{taboo}}</textarea>' +
                '              </div>'+
                '          </div>'+
                '          <div class="form-group col-sm-12 col-md-12">'+
                '              <label class="control-label">注意事项</label>'+
                '              <div class="control-input">'+
                '                  <textarea id="considerations" class="form-control" {{if status=="readonly" || (status=="update" && isApplyInCourse)}}readonly{{/if}}>{{considerations}}</textarea>' +
                '              </div>'+
                '          </div>'+
                '       </div>'+
                '       <div class="btn-box">'+
                '           {{if status=="add" || (status=="update" && resetFlag)}}<div class="resetBtn" id="reset">重置</div>{{/if}}' +
                '           {{if status=="add"}}<div class="editMedicBtn" id="addSaveBtn">添加</div>{{/if}}' +
                '           {{if status=="update"}}<div class="editMedicBtn" id="update" data-id="{{id}}" data-medicineId="{{medicine_id}}">保存</div>{{/if}}' +
                '       </div>'+
                '   </div>'+
                '</script>';
    }
    var smallClass = function() {
        return  '<script id="drugList_smallClass" type="text/html">' +
                '   {{each smallClass as value i}}' +
                '       <option value="{{value.id}}" {{if value.id==smallClassId}}selected{{/if}}>{{value.catalog_name}}</option>' +
                '   {{/each}}' +
                '</script>';
    }
    var selectCallBack = function() {
        return  '<script id="drugList_select" type="text/html">' +
                '   {{each list as value i}}' +
                '         <p class="query_item" id="{{value.id}}">{{value.medicine_name}} {{value.medicine_dose}}{{value.med_unit_name}} {{value.frequency_day}}天{{value.frequency_time}}次 {{if value.calcu_method=="01"}}体表面积{{else if value.calcu_method=="02"}}体重{{/if}} {{if value.medicine_type=="1"}}正常用药{{else if value.medicine_type=="2"}}补充用药{{/if}} {{value.parentCatalogName}}</p>' +
                '   {{/each}}' +
                '</script>';
    }
    
    return tpl;
});